Lesson 7 - Solving simple problems

There is no magic formula to solve problems (if only there was!). The ideas covered so far are designed to give you a tool set in order to solve problems. Practice is the only way you will get better! The following are tips to help

tip 1 - Understand the problem on paper!

Forget about programming! If you do not understand the problem then how on earth can you write code for it! A common rookie mistake is to start writing code before the problem is fully understood. Most problems have specific input and output so what you need to be able to do is translate the input into output.

tip 2 - write down the steps in English

You should try and write a algorithm down in English which will take a generic input and produce the correct output. Try and break down each step as much as you can. For example instead of saying "work out average" you should write down the steps to calculate the average (add each number then divide by the amount).

tip 3 - identify data storage / loops / if statements

This will form the basis of your solution. If you have done a good job with tip 2 then tip 3 should be a walk in the park!

tip 4 - run your code with test data

Use any test data given in the problem to ensure your code works as expected. You must always come up with new test data in order to ensure your code can handle a wider range of input. A good solution would work for all input.